import 'package:json_annotation/json_annotation.dart';
import 'song.dart';

part 'api_response.g.dart';

@JsonSerializable()
class SearchResponse {
  final List<Song> data;
  final int total;
  final int page;
  final int count;

  SearchResponse({
    required this.data,
    required this.total,
    required this.page,
    required this.count,
  });

  factory SearchResponse.fromJson(Map<String, dynamic> json) => _$SearchResponseFromJson(json);
  Map<String, dynamic> toJson() => _$SearchResponseToJson(this);
}

@JsonSerializable()
class UrlResponse {
  final String url;
  final int br;
  final int size;

  UrlResponse({
    required this.url,
    required this.br,
    required this.size,
  });

  factory UrlResponse.fromJson(Map<String, dynamic> json) => _$UrlResponseFromJson(json);
  Map<String, dynamic> toJson() => _$UrlResponseToJson(this);
}

@JsonSerializable()
class PicResponse {
  final String url;

  PicResponse({
    required this.url,
  });

  factory PicResponse.fromJson(Map<String, dynamic> json) => _$PicResponseFromJson(json);
  Map<String, dynamic> toJson() => _$PicResponseToJson(this);
}

@JsonSerializable()
class LyricResponse {
  final String lyric;
  final String? tlyric;

  LyricResponse({
    required this.lyric,
    this.tlyric,
  });

  factory LyricResponse.fromJson(Map<String, dynamic> json) => _$LyricResponseFromJson(json);
  Map<String, dynamic> toJson() => _$LyricResponseToJson(this);
}